<template>
  <div class="app-container">
    <el-tabs type="border-card" @tab-click="changeTab" value="enterpriseInfo">
      <el-tab-pane label="企业信息" name="enterpriseInfo">
        <el-form
          ref="enterpriseForm"
          :model="enterpriseForm"
          :rules="enterpriseFormRules"
          label-width="130px"
        >
          <el-form-item prop="companyId" style="display:none">
            <el-input v-model="enterpriseForm.companyId" type="hidden"></el-input>
          </el-form-item>
          <el-row class="line">
            <el-col>
              <el-form-item label="企业名称" prop="companyName">
                <el-input v-model="enterpriseForm.companyName"></el-input>
              </el-form-item>
            </el-col>

            <el-col>
              <el-form-item label="企业简称" prop="companyShortName">
                <el-input v-model="enterpriseForm.companyShortName"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="line">
            <el-col>
              <el-form-item label="企业类型" prop="companyType">
                <el-select v-model="enterpriseForm.companyType" placeholder="请选择">
                  <el-option
                    v-for="(item,index) in companyTypeOpt"
                    :key="index"
                    :label="item.dictValue"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col>
              <el-form-item label="企业性质" prop="companyNature">
                <el-select v-model="enterpriseForm.companyNature" placeholder="请选择">
                  <el-option
                    v-for="(item,index) in companyNatureOpt"
                    :key="index"
                    :label="item.dictValue"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="line">
            <el-col>
              <el-form-item label="企业规模" prop="companyStaffNumber">
                <el-input v-model="enterpriseForm.companyStaffNumber"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="line">
            <el-col>
              <el-form-item label="主营业务" prop="businessScope">
                <el-input type="textarea" v-model="enterpriseForm.businessScope" :rows="3"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="line">
            <el-col>
              <el-form-item label="企业实际省市" prop="companyRealDistrict">
                <el-cascader
                  size="large"
                  :options="options"
                  v-model="enterpriseForm.companyRealDistrict"
                  @change="handleChange"
                ></el-cascader>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="line">
            <el-col>
              <el-form-item label="企业实际地址" prop="companyRealAddress">
                <el-input v-model="enterpriseForm.companyRealAddress"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="line">
            <el-col :span="8">
              <el-form-item label="实际地址定位" prop="lngandlat">
                <el-input v-model="enterpriseForm.lngandlat" disabled placeholder="定位地址"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="2">
              <el-button
                type="primary"
                icon="el-icon-plus"
                @click="showMaps"
                style="margin-left:15px"
              ></el-button>
            </el-col>
          </el-row>

          <el-row class="line">
            <el-col>
              <el-form-item label="企业注册省市" prop="companyRegDistrict">
                <el-cascader
                  size="large"
                  :options="options"
                  v-model="enterpriseForm.companyRegDistrict"
                  @change="handleChange"
                ></el-cascader>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="line">
            <el-col>
              <el-form-item label="企业注册地址" prop="companyRegAddress">
                <el-input v-model="enterpriseForm.companyRegAddress"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="line">
            <el-col :span="8">
              <el-form-item label-width="130px" label="政府安全监管员" prop="managerOfficerName">
                <!-- {{enterpriseForm.managerOfficer}} -->
                <el-input
                  type="hidden"
                  v-model="enterpriseForm.managerOfficer"
                  disabled
                  style="display:none"
                ></el-input>
                <el-input
                  type="text"
                  placeholder="选择对象"
                  v-model="enterpriseForm.managerOfficerName"
                  disabled
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="2">
              <el-button
                type="primary"
                icon="el-icon-plus"
                @click="managerOfficerSelectDialogVisible=true"
                style="margin-left:15px"
              ></el-button>
            </el-col>
          </el-row>
          <el-row class="line">
            <el-col>
              <el-form-item label="企业资料" prop="multipartFile">
                <el-upload
                  ref="enterpriseInfoUpload"
                  action="#"
                  :before-upload="beforeEnterpriseUpload"
                  :on-remove="handleEnterpriseRemove"
                  :on-preview="handleEnterprisePreview"
                  :multiple="false"
                  :file-list="this.enterpriseForm.pics"
                  :http-request="httpEnterpriseRequest"
                  :on-exceed="handleEnterpriseExceed"
                  :limit="1"
                >
                  <el-button size="small" type="primary">点击上传</el-button>
                  <div slot="tip" class="el-upload__tip">只能上传rar,zip压缩文件</div>
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row class="line">
            <el-col>
              <el-form-item label="备注" prop="note">
                <el-input type="textarea" v-model="enterpriseForm.note"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-if="!this.isDetail">
            <el-col :span="24">
              <el-form-item style="text-align: center;">
                <el-button type="primary" @click="saveEnterpriseInfo">保存</el-button>
                <el-button @click="closeCurrentTag">关闭</el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="企业人员" name="peopleInfo" :disabled="isNotShow">
        <div class="filter-container" v-if="!this.isDetail">
          <el-button
            class="filter-item"
            type="primary"
            size="small"
            @click="editUser(null,'new')"
          >添加人员</el-button>
        </div>
        <el-table
          v-loading="loading"
          :data="enterpriseUsersData"
          border
          fit
          highlight-current-row
          style="width: 100%"
        >
          <!-- <el-table-column align="center" label="序号" width="80">
            <template slot-scope="scope">
              <span>{{ scope.row.id }}</span>
            </template>
          </el-table-column>-->
          <el-table-column align="center" min-width="200px" label="用户账户名" prop="userLoginAccount"></el-table-column>

          <el-table-column min-width="300px" align="center" label="用户姓名" prop="userName"></el-table-column>

          <el-table-column align="center" label="用户类型" min-width="150" prop="userTypeName"></el-table-column>
          <el-table-column align="center" label="用户电话" min-width="150" prop="userTelNumber"></el-table-column>

          <el-table-column align="center" label="操作" fixed="right" min-width="150">
            <template slot-scope="scope">
              <el-button
                type="primary"
                size="small"
                icon="el-icon-edit"
                v-if="!isDetail"
                style="margin-left:10px"
                @click="editUser(scope.row.userTypeId,'edit')"
              >编辑</el-button>
              <el-button
                size="small"
                icon="el-icon-view"
                v-if="isDetail"
                @click="editUser(scope.row.userTypeId,'watch')"
              >查看</el-button>
              <el-button
                type="danger"
                size="small"
                icon="el-icon-delete"
                v-if="!isDetail"
                @click="deleteEnterpriseUser(scope.row.userTypeId,scope.row.companyId)"
              >删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
      <el-tab-pane label="企业资质" name="otherInfo" :disabled="isNotShow">
        <div class="filter-container" v-if="!this.isDetail">
          <el-button
            class="filter-item"
            size="small"
            type="primary"
            @click="editQualification(null,'new')"
          >添加资质</el-button>
        </div>
        <el-table
          v-loading="loading"
          :data="qualificationData"
          border
          fit
          highlight-current-row
          style="width: 100%"
        >
          <el-table-column align="center" label="编号" min-width="80" prop="id"></el-table-column>
          <el-table-column align="center" min-width="200px" label="资质名称" prop="qualificationName"></el-table-column>

          <el-table-column min-width="300px" align="center" label="发证单位" prop="initiatingUnit"></el-table-column>

          <el-table-column align="center" label="取得时间" min-width="150" prop="acquisitionDate"></el-table-column>
          <el-table-column align="center" label="有效截止日期" min-width="150" prop="expireDate"></el-table-column>
          <el-table-column align="center" label="认证范围" min-width="300" prop="certificationScope"></el-table-column>

          <el-table-column align="center" label="操作" fixed="right" min-width="150">
            <template slot-scope="scope">
              <el-button
                type="primary"
                size="small"
                icon="el-icon-edit"
                v-if="!isDetail"
                style="margin-left:10px"
                @click="editQualification(scope.row.id,'edit')"
              >编辑</el-button>
              <el-button
                size="small"
                icon="el-icon-view"
                v-if="isDetail"
                @click="editQualification(scope.row.id,'watch')"
              >查看</el-button>
              <el-button
                type="danger"
                size="small"
                icon="el-icon-delete"
                v-if="!isDetail"
                @click="deleteEnterpriseQualification(scope.row.id)"
              >删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>
    <el-dialog title="企业管理员" :visible.sync="managerOfficerSelectDialogVisible" class="selectPerson">
      <div class="left">
        <fieldset class="fieldInfo">
          <legend>
            <span>组织机构树</span>
          </legend>
          <div class="tree">
            <el-tree
              ref="organizationTree"
              :data="organizationData"
              node-key="id"
              default-expand-all
              :expand-on-click-node="false"
              @node-click="handleNodeClick"
              :props="defaultProps"
            ></el-tree>
          </div>
        </fieldset>
      </div>
      <div class="right">
        <fieldset class="fieldInfo">
          <legend>
            <span>所有人员</span>
          </legend>
          <div>
            <el-radio-group v-model="checkedUser">
              <el-radio
                v-for="(user,index) in userListOptions"
                :key="index"
                :label="user.id+'_'+user.userName"
              >{{user.userName}}</el-radio>
            </el-radio-group>
          </div>
        </fieldset>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="managerOfficerSelectDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="confirmWanggePerson">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="dialogFormVisible" class="conCenter" :show-close="false">
      <el-form
        :model="qualificationForm"
        ref="qualificationForm"
        prop="id"
        :rules="qualificationFormRules"
      >
        <el-input
          v-model="qualificationForm.id"
          autocomplete="off"
          type="hidden"
          style="display:none"
        ></el-input>
        <el-form-item label="资质名称" label-width="120px" prop="qualificationName">
          <!-- <el-input v-model="qualificationForm.qualificationName" autocomplete="off"></el-input> -->
          <el-select v-model="qualificationForm.qualificationName" placeholder="请选择资质名称">
            <el-option
              v-for="item in qualificationNames"
              :key="item.id"
              :label="item.dictValue"
              :value="item.dictValue"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="发证机构" label-width="120px" prop="initiatingUnit">
          <el-input v-model="qualificationForm.initiatingUnit" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="取得日期" label-width="120px" prop="acquisitionDate">
          <el-date-picker
            v-model="qualificationForm.acquisitionDate"
            type="date"
            placeholder="请输入取得日期"
            value-format="yyyy/MM/dd"
            class="filter-item"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="有效截止日期" label-width="120px" prop="expireDate">
          <el-date-picker
            v-model="qualificationForm.expireDate"
            type="date"
            placeholder="请输入取得日期"
            value-format="yyyy/MM/dd"
            class="filter-item"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="认证范围" label-width="120px" prop="certificationScope">
          <el-input v-model="qualificationForm.certificationScope" autocomplete="off"></el-input>
        </el-form-item>
        <!-- <el-form-item label="是否通知" label-width="120px" prop="notify">
          <el-radio-group v-model="notify">
            <el-radio :label="0">不通知</el-radio>
            <el-radio :label="1">通知</el-radio>
          </el-radio-group>
        </el-form-item>-->
        <el-form-item
          v-if="this.isDetail"
          label-width="115px"
          label="资质照片"
          class="postInfo-container-item"
        >
          <ele-gallery :source="qualificationForm.pics" :height="100" :width="100"></ele-gallery>
        </el-form-item>
        <el-form-item v-else label="资质上传" label-width="120px">
          <el-upload
            ref="qualificationUpload"
            action="#"
            :before-upload="beforeAvatarUpload"
            :on-preview="handlePictureCardPreview"
            :on-remove="handleRemove"
            :multiple="false"
            :file-list="qualificationForm.pics"
            list-type="picture"
            :http-request="httpRequest"
            :on-exceed="handleExceed"
            :limit="1"
          >
            <el-button size="small" type="primary">点击上传</el-button>
            <div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
          </el-upload>
          <el-dialog :visible.sync="dialogVisible">
            <img width="100%" :src="dialogImageUrl" alt />
          </el-dialog>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="saveQualificationInfo">确 定</el-button>
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="dialogFormVisible2" class="conCenter" :show-close="false">
      <el-form :model="peopleForm" ref="peopleForm" :rules="peopleFormRules">
        <el-form-item prop="companyId" style="display:none">
          <el-input v-model="peopleForm.companyId" type="hidden"></el-input>
        </el-form-item>
        <!-- <el-form-item prop="userTypeId" style="display:none">
          <el-input v-model="peopleForm.userTypeId" type="hidden"></el-input>
        </el-form-item>-->

        <el-form-item
          prop="userTypeId"
          label-width="120px"
          label="企业用户类型"
          class="postInfo-container-item"
        >
          <el-select v-model="peopleForm.userTypeId" placeholder="用户类型">
            <el-option
              v-for="(item,index) in this.companyUserTypeOpt"
              :key="index"
              :label="item.dictValue"
              :value="item.id"
              :selected="item.selected"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="用户名" label-width="120px" prop="userLoginAccount">
          <el-input v-model="peopleForm.userLoginAccount" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="真实姓名" label-width="120px" prop="userName">
          <el-input v-model="peopleForm.userName" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="电话号码" label-width="120px" prop="userTelNumber">
          <el-input v-model="peopleForm.userTelNumber" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="savePeopleInfo" v-if="!isDetail">确 定</el-button>
        <el-button @click="dialogFormVisible2 = false">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="mapDialogVisible" class="map_dialog">
      <div slot="title">
        <div style="margin-bottom:5px">
          <el-input v-model="tempLocation" type="text" style="width:350px" placeholder="请输入位置进行定位"></el-input>
          <el-button type="primary" @click="searchLocation">搜索</el-button>
        </div>
      </div>
      <template>
        <baidu-map
          class="map"
          @ready="map_handler"
          :center="center"
          :zoom="zoom"
          :scroll-wheel-zoom="true"
          ak="bDzyj9G6pcbKEum8OHbPrTnhNV3kzg9x"
        ></baidu-map>
      </template>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="confirmMapPosition">确 定</el-button>
        <el-button @click="mapDialogVisible = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { getBaseDicInfo } from '@/api/baseApi'
import { validURL, validUsername } from '@/utils/validate'
import EleGallery from 'vue-ele-gallery'
// import pdf from 'vue-pdf'
import { BaiduMap } from 'vue-baidu-map'
import {
  addEnterprise,
  addQualification,
  addEnterprisePeople,
  updateEnterpriseUser,
  updateEnterpriseQualification,
  editEnterprise,
  fetchQualificationDetail,
  fetchEnterpriseById,
  fetchUserListByEnterpriseId,
  fetchQualificationListByEnterpriseId,
  deleteEnterpriseUserById,
  deleteEnterpriseQualificationById
} from '@/api/enterprise'

import { regionData } from 'element-china-area-data'
import { fetchTreeData, fetchUserListByOrg } from '@/api/organization'
import { searchUser } from '@/api/user'
export default {
  created() {
    this.getTreeData()
    this.getCompanyQualificationName()
    this.getCompanyTypeList()
    this.getCompanyNatureList()
    if (this.isEdit || this.isDetail) {
      //如果是编辑数据或者查询详情，根据选项卡查询数据
      const id = this.$route.params && this.$route.params.id
      this.fetchEnterpriseDetail(id)
      this.isNotShow = false
    }
    this.tempRoute = Object.assign({}, this.$route)
  },
  props: {
    isAdd: {
      type: Boolean,
      default: false
    },
    isEdit: {
      type: Boolean,
      default: false
    },
    isDetail: {
      type: Boolean,
      default: false
    }
  },
  components: {
    EleGallery,
    BaiduMap
  },
  data() {
    var validatePhone = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('手机号不能为空'))
      } else {
        const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
        // console.log(reg.test(value));
        if (reg.test(value)) {
          callback()
        } else {
          return callback(new Error('请输入正确的手机号'))
        }
      }
    }
    var validateEngUserName = (rule, value, callback) => {
      if (!value) {
        return callback(new Error('用户名不能为空'))
      } else {
        const reg = /^[a-zA-Z]+$/
        // console.log(reg.test(value));
        if (reg.test(value)) {
          callback()
        } else {
          return callback(new Error('用户名只能是英文名称'))
        }
      }
    }
    const defaultForm = {
      status: 'draft'
    }
    return {
      qualificationNames: [],
      BMap: '',
      map: '',
      tempLocation: '', //临时地址
      templngAndlat: '', //临时定位信息
      center: { lng: 106.602487, lat: 29.429754 }, //baidu地图
      zoom: 15, //baidu地图
      defaultProps: {
        label: 'name'
      },
      checkedUser: '', //选中的企业网格员
      userListOptions: [],
      organizationData: [],
      mapDialogVisible: false, //百度地图标注框
      managerOfficerSelectDialogVisible: false, //企业管理员选择对话框
      dialogImageUrl: '',
      dialogVisible: false,
      isQualificationOperType: '',
      isPeopleOperType: '',
      pdfShow: false,
      // pdfType: '',
      pdfUrl: 'http://file.dakawengu.com/file/2018-05-29/20180527-tianfeng.pdf',
      pageNum: 1,
      pageTotalNum: 1,
      pageRotate: 0,
      // 加载进度
      loadedRatio: 0,
      curPageNum: 0,
      enterpriseFormRules: {
        companyName: [
          { required: true, message: '企业名不能为空', trigger: 'blur' }
        ],
        lngandlat: [
          { required: true, message: '地址定位不能为空', trigger: 'blur' }
        ],

        companyType: [
          { required: true, message: '企业类型不能为空', trigger: 'blur' }
        ],
        companyNature: [
          { required: true, message: '企业性质不能为空', trigger: 'blur' }
        ],
        companyRealDistrict: [
          { required: true, message: '企业地址不能为空', trigger: 'blur' }
        ],
        // companyStaffNumber: [
        //   {
        //     type: 'number',
        //     min: 0,
        //     message: '企业规模必须是数字',
        //     trigger: 'blur'
        //   }
        // ],
        companyRealAddress: [
          { required: true, message: '企业地址不能为空', trigger: 'blur' }
        ],
        managerOfficerName: [
          { required: true, message: '企业管理员不能为空', trigger: 'blur' }
        ]
        // companyRegDistrict: [
        //   { required: true, message: '企业注册地址不能为空', trigger: 'blur' }
        // ],
        // companyRegAddress: [
        //   { required: true, message: '企业注册地址不能为空', trigger: 'blur' }
        // ]
      },
      peopleFormRules: {
        userTypeId: [
          { required: true, message: '企业用户类型不能为空', trigger: 'blur' }
        ],
        userLoginAccount: [
          { required: true, message: '用户名不能为空', trigger: 'blur' },
          { validator: validateEngUserName, trigger: 'blur' }
        ],
        userName: [
          { required: true, message: '用户姓名不能为空', trigger: 'blur' }
        ],
        userTelNumber: [
          { required: true, message: '电话号码不能为空', trigger: 'blur' },
          { validator: validatePhone, trigger: 'blur' }
        ]
      },
      qualificationFormRules: {
        qualificationName: [
          { required: true, message: '资质名称不能为空', trigger: 'blur' }
        ],
        initiatingUnit: [
          { required: true, message: '发证单位不能为空', trigger: 'blur' }
        ],
        // acquisitionDate: [
        //   { required: true, message: '取得日期不能为空', trigger: 'blur' }
        // ],
        expireDate: [
          { required: true, message: '有效截止日期不能为空', trigger: 'blur' }
        ]
        // certificationScope: [
        //   { required: true, message: '认证范围不能为空', trigger: 'blur' }
        // ]
      },
      companyTypeOpt: [],
      companyNatureOpt: [],
      companyUserTypeOpt: [],
      options: regionData,
      // selectedOpt: [],
      // RegDistrictOpt:[],
      isNotShow: true, // 是否禁用选项卡的添加资质
      url:
        'http://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf',
      loading: false,
      dialogFormVisible2: false, //企业人员弹窗
      dialogFormVisible: false, //企业资质弹窗
      // previewFile: false, //文件预览
      enterpriseForm: {
        companyId: '',
        companyName: '', //企业名称
        businessScope: '', //营业范围
        companyRegDistrict: [], //注册地区
        companyRegAddress: '', //注册地址
        companyShortName: '', //公司简称
        companyType: '', //公司类型
        companyNature: '', //公司性质
        companyStaffNumber: '', //企业规模
        companyRealDistrict: ['500000', '500100', '500108'], //企业所在地区
        companyRealAddress: '', //企业地址
        managerOfficer: '', //企业管理员
        managerOfficerName: '', //企业管理员名称
        note: '',
        lngandlat: '', //经纬度,
        multipartFile: '', //企业资料
        pics: []
      },
      peopleForm: {
        userTypeId: '', //人员id
        companyId: '', //公司id
        userLoginAccount: '', //登录名
        userName: '', //姓名
        userTelNumber: '', //电话号码
        userTypeName: '' //用户类型(安全负责人，法人代表)
      },
      // imgfileList: [],
      qualificationForm: {
        id: '',
        fileId: '',
        companyId: '',
        qualificationName: '', // 资质名称
        initiatingUnit: '', //发证单位
        acquisitionDate: '', //取得时间
        expireDate: '', //截止时间
        certificationScope: '', //认证范围
        file: '', //单个文件,
        pics: []
      },
      enterpriseUsersData: [],
      qualificationData: []
    }
  },
  methods: {
    getCompanyQualificationName() {
      getBaseDicInfo({ typeId: 15 }).then((response) => {
        this.qualificationNames = response.data
      })
    },
    //baidu地图相关方法
    geocodeSearch(myGeo, location) {
      myGeo.getPoint(
        location,
        (point) => {
          if (point) {
            this.map.centerAndZoom(point, 15)
            // console.log(point.lng + ',' + point.lat)
            // var marker = new that.BMap.Marker(point) // 创建标注
            // that.map.addOverlay(marker) // 将标注添加到地图中
            // that.addMarker(point, company)
          }
        },
        '重庆市'
      )
    },
    searchLocation() {
      const myGeo = new this.BMap.Geocoder()
      this.geocodeSearch(myGeo, this.tempLocation)
    },
    showMaps() {
      this.mapDialogVisible = true
      this.center.lng = 106.602487
      this.center.lat = 29.429754
      this.zoom = 15
    },
    confirmMapPosition() {
      // this.lngAndlat = `${lng},${lat}`
      this.enterpriseForm.lngandlat = this.templngAndlat
      this.mapDialogVisible = false
    },

    map_handler({ BMap, map }) {
      this.BMap = BMap
      this.map = map

      // map.disableDragging()
      map.enableScrollWheelZoom(true)

      const myGeo = new this.BMap.Geocoder()
      if (this.enterpriseForm.lngandlat) {
        map.clearOverlays()
        let p1 = new BMap.Point(
          this.enterpriseForm.lngandlat.split(',')[0],
          this.enterpriseForm.lngandlat.split(',')[1]
        )
        let marker = new BMap.Marker(p1) // 创建标注
        map.addOverlay(marker) // 将标注添加到地图中
      }
      if (
        /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)
      ) {
        //   map.disableDragging()
        //   map.addEventListener('touchstart', (e) => {
        //     map.disableDragging()
        //     map.clearOverlays()
        //     let lng = e.point.lng
        //     let lat = e.point.lat
        //     console.log('11111111111111', e.point.lng, e.point.lat)
        //     let p1 = new BMap.Point(lng, lat)
        //     let marker = new BMap.Marker(p1) // 创建标注
        //     map.addOverlay(marker) // 将标注添加到地图中
        //     this.templngAndlat = `${lng},${lat}`
        //   })
        //   map.addEventListener('touchmove', (e) => {
        //     map.enableDragging()
        //   })
        //   map.addEventListener('touchend', (e) => {
        //     map.disableDragging()
        //     // let lng = e.point.lng
        //     // let lat = e.point.lat
        //     // console.log('11111111111111', e.point.lng, e.point.lat)
        //     // let p1 = new BMap.Point(lng, lat)
        //     // let marker = new BMap.Marker(p1) // 创建标注
        //     // map.addOverlay(marker) // 将标注添加到地图中
        //     // this.templngAndlat = `${lng},${lat}`
        //   })
        // } else {
        //   map.addEventListener('click', (e) => {
        //     map.clearOverlays()
        //     let lng = e.point.lng
        //     let lat = e.point.lat
        //     // map.centerAndZoom(e.point, 18)
        //     // myGeo.getLocation(e.point, function(rs) {
        //     //   var addComp = rs.addressComponents
        //     //   console.log(rs)
        //     // })
        //     let p1 = new BMap.Point(lng, lat)
        //     let marker = new BMap.Marker(p1) // 创建标注
        //     map.addOverlay(marker) // 将标注添加到地图中
        //     this.templngAndlat = `${lng},${lat}`
        //     // console.log(this.templngAndlat)
        //   })
        // }
        var xArr = [] //存放横坐标
        var yArr = [] //存放纵坐标
        //点击事件获取地址信息start------------------------
        //手指触摸屏幕的时候清空两个数组
        map.addEventListener('touchstart', (e) => {
          xArr.length = 0
          yArr.length = 0
          console.log('touchstart', xArr, yArr)
        })
        //如果滑动了屏幕，xArr和yArr将各存入两个坐标值，即始末坐标值
        map.addEventListener('touchmove', (e) => {
          xArr.push(e.targetTouches[0].pageX)
          yArr.push(e.targetTouches[0].pageY)

          console.log('touchstart', xArr, yArr)
        })
        map.addEventListener('touchend', (e) => {
          var far
          var flag = true
          //计算平移距离，区分滑动事件和点击事件
          if (xArr.length > 1 && yArr.length > 1) {
            far =
              (Math.abs(xArr[0] - xArr[1]) ^ 2) +
              (Math.abs(yArr[0] - yArr[1]) ^ 2)
            if (far > 0) {
              flag = false
            }
          }
          if (flag) {
            //false表示滑动事件，true表示点击事件
            var pix = new BMap.Pixel(e.pixel.x, e.pixel.y - 197)
            var point = map.pixelToPoint(pix)
            console.log('touchend', flag, e, point.lng, point.lat)
            map.clearOverlays() //清除地图上所有覆盖物
            // map.centerAndZoom(new BMap.Point(e.point.lng, e.point.lat), 18)
            map.addOverlay(
              // new BMap.Marker(new BMap.Point(e.point.lng, e.point.lat))
              new BMap.Marker(new BMap.Point(point.lng, point.lat))
            )
            this.templngAndlat = `${point.lng},${point.lat}`
          }
        })
      } else {
        map.addEventListener('click', (e) => {
          map.clearOverlays()
          let lng = e.point.lng
          let lat = e.point.lat
          // map.centerAndZoom(e.point, 18)
          // myGeo.getLocation(e.point, function(rs) {
          //   var addComp = rs.addressComponents
          //   console.log(rs)
          // })
          let p1 = new BMap.Point(lng, lat)
          let marker = new BMap.Marker(p1) // 创建标注
          map.addOverlay(marker) // 将标注添加到地图中
          this.templngAndlat = `${lng},${lat}`
          // console.log(this.templngAndlat)
        })
      }
    },
    //点击树节点的时候，获取对应的组织用户信息列表
    handleNodeClick(data, node) {
      // console.log(data, node)
      // this.currentSelectNode = node
      // this.postForm.organizationName = data.name
      // this.dialogForm.parentOrganizationName = data.name
      // this.postForm.comment = data.comment
      this.getRemoteUserList(data.id)
    },
    getRemoteUserList(orgId = 1) {
      // this.managerOfficerSelectDialogVisible = true
      fetchUserListByOrg(orgId).then((response) => {
        this.userListOptions = response.data.map((v) => {
          return {
            id: v.id,
            userLoginAccount: v.userLoginAccount,
            userName: v.userName
          }
        })
      })
    },
    confirmWanggePerson() {
      this.enterpriseForm.managerOfficer = this.checkedUser.split('_')[0]
      this.enterpriseForm.managerOfficerName = this.checkedUser.split('_')[1]
      this.managerOfficerSelectDialogVisible = false
    },

    getTreeData() {
      fetchTreeData({
        rootId: 0
      }).then((response) => {
        console.log(response.data)
        this.organizationData = response.data
      })
    },
    closeCurrentTag() {
      // 调用全局挂载的方法
      this.$store.dispatch('tagsView/delView', this.$route)
      // 返回上一步路由
      this.$router.go(-1)
    },
    //上传企业资料的设置
    beforeEnterpriseUpload(file) {
      //资料上传前资料大小和类型判断
      const fileName = file.name
      const extension = fileName.substring(
        fileName.lastIndexOf('.') + 1,
        fileName.length
      )
      const isType = extension == 'zip' || extension == 'rar'
      console.log('type', isType, extension)
      // const isSize = file.size / 1024 / 1024 / 50 < 1

      if (!isType) {
        this.$message.error('上传文件类型不正确！')
      }
      // if (!isSize) {
      //   this.$message.error('上传文件不能超过50MB！')
      // }
      // return isType && isSize
      return isType
    },
    httpEnterpriseRequest(data) {
      // console.log('httprequest')
      // console.log('data.file', data.file)
      // this.qualificationForm.fileList.push(data.file)
      this.enterpriseForm.multipartFile = data.file
      // console.log('this.postForm.fileList', this.postForm.fileList)
    },
    handleEnterpriseRemove(file, fileList) {
      // console.log('删除----', file, fileList)
      // this.qualificationForm.fileList = []
      this.enterpriseForm.multipartFile = ''
    },
    handleEnterpriseExceed(files, fileList) {
      console.log(files, fileList)
      // this.$message.warning(
      //   `当前限制选择 1 个文件，本次选择了 ${
      //     files.length
      //   } 个文件，共选择了 ${files.length + fileList.length} 个文件`
      // )
      this.$message.warning(`当前限制选择 1 个文件，请删除已有文件再上传`)
    },
    beforeEnterpriseRemove(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`)
    },
    handleEnterprisePreview(file) {
      console.log('file------------', file)
      // let url = URL.createObjectURL(file.raw)
      // let reader = new FileReader()
      // let rs = reader.readAsArrayBuffer(file.raw)
      // let blob = null
      // reader.onload = (e) => {
      //   if (typeof e.target.result === 'object') {
      //     blob = new Blob([e.target.result], { type: 'application/zip' })
      //   } else {
      //     blob = e.target.result
      //   }
      //   let url = window.URL.createObjectURL(blob)
      //   window.open(url)
      // }
      window.open(file.src)
    },
    // 上传资质之前的格式设置
    beforeAvatarUpload(file) {
      //图片上传前图片大小和类型判断
      const isImg = file.type === 'image/jpeg' || 'image/jpg' || 'image/png'
      // const isSize = file.size / 1024 / 1024 < 1
      if (!isImg) {
        this.$message.error('上传文件只能是图片格式！')
      }
      // if (!isSize) {
      //   this.$message.error('上传图片不能超过1MB！')
      // }
      // return isImg && isSize
      return isImg
    },
    httpRequest(data) {
      // console.log('httprequest')
      // console.log('data.file', data.file)
      // this.qualificationForm.fileList.push(data.file)
      this.qualificationForm.file = data.file
      // console.log('this.postForm.fileList', this.postForm.fileList)
    },
    handleRemove(file, fileList) {
      // console.log('删除----', file, fileList)
      // this.qualificationForm.fileList = []
      this.qualificationForm.file = ''
    },
    handleExceed(files, fileList) {
      console.log(files, fileList)
      // this.$message.warning(
      //   `当前限制选择 1 个文件，本次选择了 ${
      //     files.length
      //   } 个文件，共选择了 ${files.length + fileList.length} 个文件`
      // )
      this.$message.warning(`当前限制选择 1 个文件，请删除已有文件再上传`)
    },
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${file.name}？`)
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url
      this.dialogVisible = true
    },

    deleteEnterpriseUser(id, companyId) {
      deleteEnterpriseUserById(id, companyId).then((response) => {
        if (response.success) {
          this.fetchUserListByEnterprise({
            companyId: this.enterpriseForm.companyId
          })
        }
      })
    },
    deleteEnterpriseQualification(id) {
      deleteEnterpriseQualificationById(id).then((response) => {
        if (response.success) {
          this.fetchQualificationListByEnterprise({
            companyId: this.enterpriseForm.companyId
          })
        }
      })
    },
    fetchUserListByEnterprise(data) {
      fetchUserListByEnterpriseId(data).then((response) => {
        this.enterpriseUsersData = response.data
      })
    },
    fetchQualificationListByEnterprise(data) {
      fetchQualificationListByEnterpriseId(data).then((response) => {
        this.qualificationData = response.data
      })
    },
    changeTab(tabInfo) {
      if (this.isAdd) {
        //如果是新增
        if (tabInfo.name == 'peopleInfo') {
          //查询企业人员信息
          this.getCompanyUserTypeList()
          this.peopleForm.companyId = this.enterpriseForm.companyId
        } else if (tabInfo.name == 'otherInfo') {
          //查询企业资质信息
          this.qualificationForm.companyId = this.enterpriseForm.companyId
        }
      }
      //调数据
      if (this.isEdit || this.isDetail) {
        //如果是编辑数据或者查询详情，根据选项卡查询数据列表
        const id = this.$route.params && this.$route.params.id
        if (tabInfo.name == 'peopleInfo') {
          //查询企业人员信息
          console.log('查询企业人员信息')
          this.getCompanyUserTypeList()
          this.peopleForm.companyId = this.enterpriseForm.companyId
          this.fetchUserListByEnterprise({
            companyId: this.enterpriseForm.companyId
          })
        } else if (tabInfo.name == 'otherInfo') {
          //查询企业资质信息
          console.log('查询企业资质信息')
          this.qualificationForm.companyId = this.enterpriseForm.companyId
          this.fetchQualificationListByEnterprise({
            companyId: this.enterpriseForm.companyId
          })
        }
        this.isNotShow = false
      }
      // console.log(tabInfo)
    },
    getCompanyUserTypeList() {
      //获取企业员工类型
      getBaseDicInfo({ typeId: 13 }).then((response) => {
        this.companyUserTypeOpt = response.data
      })
    },
    getCompanyTypeList() {
      //获取企业类型
      getBaseDicInfo({ typeId: 12 }).then((response) => {
        this.companyTypeOpt = response.data
      })
    },
    getCompanyNatureList() {
      //获取企业性质
      getBaseDicInfo({ typeId: 11 }).then((response) => {
        this.companyNatureOpt = response.data
      })
    },
    handleChange(value) {
      console.log(value)
    },
    editUser(userTypeId, type) {
      this.dialogFormVisible2 = true
      this.isPeopleOperType = type
      // console.log('type---reset', type)
      if (type == 'edit' || type == 'watch') {
        this.enterpriseUsersData.map((e) => {
          if (e.userTypeId == userTypeId) {
            this.peopleForm = e
          }
        })
      } else if (type == 'new') {
        //如果是新增人员
        this.$nextTick(() => {
          // this.$refs['peopleForm'].resetFields()
          this.peopleForm = {
            userTypeId: '',
            companyId: this.enterpriseForm.companyId,
            userLoginAccount: '',
            userName: '',
            userTelNumber: '',
            userTypeName: ''
          }
        })
      }
    },
    editQualification(id, type) {
      this.dialogFormVisible = true
      // this.pdfType = type
      this.isQualificationOperType = type
      if (type == 'edit' || type == 'watch') {
        //如果是编辑或查看资质,查询该资质详情
        fetchQualificationDetail(id).then((response) => {
          this.qualificationForm = response.data
          if (type == 'edit') {
            this.qualificationForm.pics = [
              {
                id: response.data.id,
                name: response.data.fileUrl.substring(
                  response.data.fileUrl.lastIndexOf('/') + 1,
                  response.data.fileUrl.length
                ),
                url: '/api' + response.data.fileUrl
              }
            ]
          } else {
            this.qualificationForm.pics = [
              {
                id: response.data.id,
                title: response.data.fileUrl.substring(
                  response.data.fileUrl.lastIndexOf('/') + 1,
                  response.data.fileUrl.length
                ),
                src: '/api' + response.data.fileUrl
              }
            ]
          }
        })
      } else if (type == 'new') {
        //如果是新增资质
        this.$nextTick(() => {
          this.$refs['qualificationForm'].resetFields()
          this.$refs['qualificationUpload'].clearFiles()
        })
      }
    },

    fetchEnterpriseDetail(id) {
      fetchEnterpriseById(id)
        .then((response) => {
          this.enterpriseForm = response.data
          this.enterpriseForm.companyRegDistrict = this.enterpriseForm.companyRegDistrict.split(
            ','
          )
          this.enterpriseForm.companyRealDistrict = this.enterpriseForm.companyRealDistrict.split(
            ','
          )
          this.enterpriseForm.pics = [
            {
              id: response.data.companyFileInfo.id,
              name: response.data.companyFileInfo.name,
              src: '/api' + response.data.companyFileInfo.url
            }
          ]

          // console.log('enterpriseForm+++++++++++++++=', response.data)

          this.setTagsViewTitle()
          this.setPageTitle()
        })
        .catch((err) => {
          console.log(err)
        })
    },
    setTagsViewTitle() {
      let title = '编辑'
      if (this.isDetail) {
        title = '查看'
      }
      const route = Object.assign({}, this.tempRoute, {
        title: `${title}-${this.enterpriseForm.companyName}`
      })
      this.$store.dispatch('tagsView/updateVisitedView', route)
    },
    setPageTitle() {
      let title = '编辑'
      if (this.isDetail) {
        title = '查看'
      }
      document.title = `${title} - ${this.enterpriseForm.companyName}`
    },
    saveEnterpriseInfo() {
      //保存企业信息
      this.$refs.enterpriseForm.validate((valid) => {
        if (valid) {
          this.loading = true
          if (!this.isEdit) {
            //如果是新增企业
            this.enterpriseForm.companyRealDistrict = this.enterpriseForm.companyRealDistrict.join(
              ','
            )
            if (this.enterpriseForm.companyRegDistrict) {
              this.enterpriseForm.companyRegDistrict = this.enterpriseForm.companyRegDistrict.join(
                ','
              )
            }

            // console.log(this.enterpriseForm)
            const formData = new FormData()
            formData.append('companyName', this.enterpriseForm.companyName)
            formData.append('businessScope', this.enterpriseForm.businessScope)
            formData.append(
              'companyRegDistrict',
              this.enterpriseForm.companyRegDistrict
            )
            formData.append(
              'companyRegAddress',
              this.enterpriseForm.companyRegAddress
            )
            formData.append(
              'companyShortName',
              this.enterpriseForm.companyShortName
            )
            formData.append('companyType', this.enterpriseForm.companyType)
            formData.append('companyNature', this.enterpriseForm.companyNature)
            formData.append(
              'companyStaffNumber',
              this.enterpriseForm.companyStaffNumber
            )
            formData.append(
              'companyRealDistrict',
              this.enterpriseForm.companyRealDistrict
            )
            formData.append(
              'companyRealAddress',
              this.enterpriseForm.companyRealAddress
            )
            formData.append(
              'managerOfficer',
              this.enterpriseForm.managerOfficer
            )
            formData.append(
              'managerOfficerName',
              this.enterpriseForm.managerOfficerName
            )
            formData.append('note', this.enterpriseForm.note)
            formData.append('lngandlat', this.enterpriseForm.lngandlat)
            formData.append(
              'multipartFile',
              this.enterpriseForm.multipartFile || ''
            )
            addEnterprise({ formData }).then((res) => {
              if (res.success) {
                this.$notify({
                  title: '成功',
                  message: '新增企业成功',
                  type: 'success',
                  duration: 2000
                })
                this.$refs['enterpriseForm'].resetFields()
                this.$refs['enterpriseInfoUpload'].clearFiles()
                this.enterpriseForm.companyId = res.data
                this.isNotShow = false
                this.loading = false
              } else {
                this.$notify({
                  title: '失败',
                  message: '新增企业失败',
                  type: 'error',
                  duration: 2000
                })
              }
            })
          } else {
            //如果是编辑企业
            console.log('enterpriseForm-------------', this.enterpriseForm)
            if (typeof this.enterpriseForm.companyRealDistrict != 'string') {
              this.enterpriseForm.companyRealDistrict = this.enterpriseForm.companyRealDistrict.join(
                ','
              )
            }
            if (typeof this.enterpriseForm.companyRegDistrict != 'string') {
              if (this.enterpriseForm.companyRegDistrict) {
                this.enterpriseForm.companyRegDistrict = this.enterpriseForm.companyRegDistrict.join(
                  ','
                )
              }
            }
            const formData = new FormData()
            formData.append('companyId', this.enterpriseForm.companyId)
            formData.append('companyName', this.enterpriseForm.companyName)
            formData.append('businessScope', this.enterpriseForm.businessScope)
            formData.append(
              'companyRegDistrict',
              this.enterpriseForm.companyRegDistrict
            )
            formData.append(
              'companyRegAddress',
              this.enterpriseForm.companyRegAddress
            )
            formData.append(
              'companyShortName',
              this.enterpriseForm.companyShortName
            )
            formData.append('companyType', this.enterpriseForm.companyType)
            formData.append('companyNature', this.enterpriseForm.companyNature)
            formData.append(
              'companyStaffNumber',
              Number(this.enterpriseForm.companyStaffNumber)
            )
            formData.append(
              'companyRealDistrict',
              this.enterpriseForm.companyRealDistrict
            )
            formData.append(
              'companyRealAddress',
              this.enterpriseForm.companyRealAddress
            )
            formData.append(
              'managerOfficer',
              this.enterpriseForm.managerOfficer
            )
            formData.append(
              'managerOfficerName',
              this.enterpriseForm.managerOfficerName
            )
            formData.append('note', this.enterpriseForm.note)
            formData.append('lngandlat', this.enterpriseForm.lngandlat)
            formData.append('multipartFile', this.enterpriseForm.multipartFile)
            editEnterprise({ formData }).then((res) => {
              if (res.success) {
                this.$notify({
                  title: '成功',
                  message: '编辑企业成功',
                  type: 'success',
                  duration: 2000
                })
                // this.form.status = 'published'
                this.loading = false

                // this.isAddCti = false
              } else {
                this.$notify({
                  title: '失败',
                  message: '编辑企业失败',
                  type: 'error',
                  duration: 2000
                })
              }
            })
          }
        } else {
          this.$notify({
            title: '失败',
            message: '企业验证失败',
            type: 'error',
            duration: 2000
          })
          return false
        }
      })
    },
    savePeopleInfo() {
      //保存企业人员信息
      this.$refs.peopleForm.validate((valid) => {
        if (valid) {
          this.loading = true
          if (this.isPeopleOperType == 'new') {
            //新增企业用户
            console.log('this.peopleForm', this.peopleForm)
            addEnterprisePeople(this.peopleForm).then((res) => {
              if (res.success) {
                this.$notify({
                  title: '成功',
                  message: '保存人员成功',
                  type: 'success',
                  duration: 2000
                })
                // this.postForm.status = 'published';
                this.fetchUserListByEnterprise({
                  companyId: this.enterpriseForm.companyId
                })
                this.loading = false
              } else {
                this.$notify({
                  title: '失败',
                  message: '保存人员失败',
                  type: 'error',
                  duration: 2000
                })
              }
            })
          } else if (this.isPeopleOperType == 'edit') {
            //如果是编辑企业用户
            console.log('editUser', this.peopleForm)
            updateEnterpriseUser(this.peopleForm).then((res) => {
              if (res.success) {
                this.$notify({
                  title: '成功',
                  message: '编辑人员成功',
                  type: 'success',
                  duration: 2000
                })
                // this.postForm.status = 'published';
                this.fetchUserListByEnterprise({
                  companyId: this.enterpriseForm.companyId
                })
                this.loading = false
              } else {
                this.$notify({
                  title: '失败',
                  message: '编辑人员失败',
                  type: 'error',
                  duration: 2000
                })
              }
            })
          }
        } else {
          this.$notify({
            title: '失败',
            message: '验证失败',
            type: 'error',
            duration: 2000
          })
          return false
        }
      })
    },
    saveQualificationInfo() {
      //保存企业人员信息
      this.$refs.qualificationForm.validate((valid) => {
        if (valid) {
          this.loading = true
          if (this.isQualificationOperType == 'new') {
            console.log(this.isQualificationOperType, this.qualificationForm)
            //如果是新增企业资质
            const formData = new FormData()
            formData.append('companyId', this.qualificationForm.companyId)
            formData.append(
              'qualificationName',
              this.qualificationForm.qualificationName
            )
            formData.append(
              'initiatingUnit',
              this.qualificationForm.initiatingUnit
            )
            formData.append(
              'acquisitionDate',
              this.qualificationForm.acquisitionDate || ''
            )
            formData.append('expireDate', this.qualificationForm.expireDate)
            formData.append(
              'certificationScope',
              this.qualificationForm.certificationScope
            )
            // this.qualificationForm.fileList.forEach((file) => {
            //   formData.append('multipartFile', file, file.name)
            // })
            if (this.qualificationForm.file) {
              formData.append(
                'multipartFile',
                this.qualificationForm.file,
                this.qualificationForm.file.name
              )
            }

            // for (var key of formData.entries()) {
            //   console.log(key[0] + ', ' + key[1])
            // }
            addQualification({ formData }).then((res) => {
              if (res.success) {
                this.$notify({
                  title: '成功',
                  message: '保存资质成功',
                  type: 'success',
                  duration: 2000
                })
                // this.postForm.status = 'published';
                this.fetchQualificationListByEnterprise({
                  companyId: this.enterpriseForm.companyId
                })
                this.loading = false
              } else {
                this.$notify({
                  title: '失败',
                  message: '保存资质失败',
                  type: 'error',
                  duration: 2000
                })
              }
            })
          } else if (this.isQualificationOperType == 'edit') {
            //如果是编辑企业资质
            const formData = new FormData()
            formData.append('id', this.qualificationForm.id)
            formData.append('companyId', this.qualificationForm.companyId)
            formData.append('fileId', this.qualificationForm.fileId || '')
            formData.append(
              'qualificationName',
              this.qualificationForm.qualificationName
            )
            formData.append(
              'initiatingUnit',
              this.qualificationForm.initiatingUnit
            )
            formData.append(
              'acquisitionDate',
              this.qualificationForm.acquisitionDate || ''
            )
            formData.append('expireDate', this.qualificationForm.expireDate)
            formData.append(
              'certificationScope',
              this.qualificationForm.certificationScope
            )
            if (this.qualificationForm.file) {
              formData.append(
                'multipartFile',
                this.qualificationForm.file,
                this.qualificationForm.file.name
              )
            }

            updateEnterpriseQualification({ formData }).then((res) => {
              if (res.success) {
                this.$notify({
                  title: '成功',
                  message: '更新资质成功',
                  type: 'success',
                  duration: 2000
                })
                // this.postForm.status = 'published';
                this.fetchQualificationListByEnterprise({
                  companyId: this.enterpriseForm.companyId
                })
                this.loading = false
              } else {
                this.$notify({
                  title: '失败',
                  message: '更新资质失败',
                  type: 'error',
                  duration: 2000
                })
              }
            })
          }
        } else {
          this.$notify({
            title: '失败',
            message: '验证失败',
            type: 'error',
            duration: 2000
          })
          return false
        }
      })
    }
  }
}
</script>
<style scoped lang="scss">
.map {
  width: 100%;
  height: 300px;
}
.selectPerson /deep/ .el-dialog__body {
  display: flex;
  .left {
    flex: 1;
  }
  .right {
    flex: 1;
  }
}
.map_dialog /deep/ .el-dialog__body {
  padding: 5px 10px;
}
.map_dialog /deep/ .el-dialog__header {
  padding: 15px 10px 0px 10px;
}
.map_dialog /deep/ .el-dialog__headerbtn {
  top: 5px;
  right: 10px;
}
// @import '~@/styles/mixin.scss';
// .pdf {
//   display: flex;
//   justify-content: space-around;
//   align-items: center;
// }
</style>
